package com.jiashihui.server1.constant;

import java.util.HashMap;
import java.util.Map;

/**

  * @Description:    类常量定义
  * @Author:         jiashihui
  * @CreateDate:     2019/2/18 10:19
  * @Version:        1.0
 * 类常量比接口常量好，因为可以定义状态码对应的提示信息
 */
public class ResponseCode {
	/** 系统处理正常 */
	public static final int SUCCESS_HEAD = 0;

	/** 系统处理未知异常 */
	public static final int EXCEPTION_HEAD = 1;

	/** JSON解析错误 */
	public static final int JSON_RESOLVE = 2;

	/** 类型不匹配 */
	public static final int TRANSTYPE_NO = 3;

	/** Head - messageID未赋值 */
	public static final int HEAD_messageID = 4;

	/** Head - timeStamp未赋值 */
	public static final int HEAD_timeStamp = 5;

	/** Head - messengerID未赋值 */
	public static final int HEAD_messengerID = 6;

	/** Head - transactionType 未赋值 */
	public static final int HEAD_transactionType = 7;

	/** digest校验不通过 */
	public static final int HEAD_DIGEST = 8;

	/** src校验不通过 */
	public static final int HEAD_SRC_NULL = 10;

	/** 协议包含非法字符 */
	public static final int ILLEGAL_MESSAGE = 11;

	/** 数据库异常 */
	public static final int DATABASE_EXCEPTION = 9;

	public static final Map<Integer, String> RESP_INFO = new HashMap<Integer, String>();
	static {
		// Head 相关
		RESP_INFO.put(SUCCESS_HEAD, "系统处理正常");
		RESP_INFO.put(EXCEPTION_HEAD, "系统处理未知异常");
		RESP_INFO.put(JSON_RESOLVE, "JSON解析错误");
		RESP_INFO.put(TRANSTYPE_NO, "类型不匹配");
		RESP_INFO.put(HEAD_messageID, "messageID未赋值");
		RESP_INFO.put(HEAD_timeStamp, "timeStamp未赋值");
		RESP_INFO.put(HEAD_messengerID, "messengerID未赋值");
		RESP_INFO.put(HEAD_transactionType, "transactionType未赋值");
		RESP_INFO.put(HEAD_DIGEST, "digest校验不通过");
		RESP_INFO.put(DATABASE_EXCEPTION, "数据库异常");
		RESP_INFO.put(HEAD_SRC_NULL, "src未赋值");
		RESP_INFO.put(ILLEGAL_MESSAGE, "协议包含非法字符");
	}
}